import request from "../utils/request.js";

export function categoryTree() {
  return request({
    url: "/catTree/categoryTree",
    method: "get",
  });
}

export function selectAllByCate(current, size, name, status, pid, id) {
  return request({
    url: "/dish/selectAllByCate",
    method: "post",
    params: {
      current,
      size,
      name,
      status,
      id,
      pid,
    },
  });
}

//修改
export function getUpdateById(updatedish) {
  return request({
    url: "/dish/update",
    method: "post",
    data: updatedish,
  });
}

//删除
export function getDeleteById(id) {
  return request({
    url: "/dish/delete",
    method: "post",
    params: {
      id,
    },
  });
}

//通过id查询
export function selectById(id) {
  return request({
    url: "/dish/selectById",
    method: "post",
    params: {
      id,
    },
  });
}
//修改状态
export function updateStatus(id, status) {
  return request({
    url: "/dish/updateStatus",
    method: "post",
    params: {
      id,
      status,
    },
  });
}

//新增
export function getInsert(dish) {
  return request({
    url: "/dish/insert",
    method: "post",
    data: dish,
  });
}
